/*
 * vectortable.c
 * This file holds the interrupt vector table
 
 * $Author: b06900 $
 * $Date: 2008/03/05 22:49:09 $
 * $Name:  $
 */
#include "pub_def.h"
#include "app_config.h"
#include "freescale_radio_hardware.h"

//#define HCS08Q 

#if defined (HCS08Q)
  typedef void __near(* __near tIsrFunc)(void);
#else
  typedef void(*tIsrFunc)(void);
#endif
 
//extern interrupt void KBD_ISR();

//*****************************
//Put your ISR routines here.
//extern interrupt void yourAppISR(void);
#if defined (HCS08Q)
  #pragma CODE_SEG __NEAR_SEG NON_BANKED
    extern __interrupt void Vscirx();
    extern __interrupt void IRQIsr(void);
    extern __interrupt void IRQTimer1();
    extern __interrupt void KBIisr();    
  #pragma CODE_SEG DEFAULT
#else
  extern interrupt void isrSCI();
  extern interrupt void IRQIsr(void);
  extern interrupt void IRQTimer1();
  extern interrupt void KBIisr();
#endif
//Put the Function Name of your interrupt handler into this constant array.
//at the ISR location that you want.

#if defined (HCS08Q)
  #pragma CODE_SEG __NEAR_SEG NON_BANKED
    __interrupt void UnimplementedISR(void)
    {
      for(;;);
    }  
  #pragma CODE_SEG DEFAULT  
#else
  interrupt void UnimplementedISR(void)
  {
    for(;;);
  }  
#endif



#if defined (HCS08Q)


  // Added redirected ISR vectors when BootLoader is enabled.
  // The application cannot have a reset vector (resides in BootLoader).

      const tIsrFunc _vect[] @0xFFC0 = {  /* Interrupt table */

        // Interrupt table
        UnimplementedISR,       // vector 31   - TPM3 overflow
        UnimplementedISR,       // vector 30   - TPM3 channel 5
        UnimplementedISR,       // vector 29   - TPM3 channel 4
        UnimplementedISR,       // vector 28   - TPM3 channel 3
        UnimplementedISR,       // vector 27   - TPM3 channel 2
        UnimplementedISR,       // vector 26   - TPM3 channel 1
        UnimplementedISR,       // vector 25   - TPM3 channel 0
        UnimplementedISR,       // vector 24   - Real time interrupt
        UnimplementedISR,       // vector 23   - SCI2 transmit
        Vscirx   ,              // vector 22   - SCI2 receive
        UnimplementedISR,       // vector 21   - SCI2 error
        UnimplementedISR,       // vector 20   - Analog comparator x
        UnimplementedISR,       // vector 19   - ADC        
        KBIisr,                 // vector 18   - Keyboard x pins
        UnimplementedISR,       // vector 17   - IICx control        
        UnimplementedISR,       // vector 16   - SCI1 transmit
        Vscirx,                 // vector 15   - SCI1 receive
        UnimplementedISR,       // vector 14   - SCI1 error
        UnimplementedISR,       // vector 13   - SPI1
        UnimplementedISR,       // vector 12   - SPI2
        UnimplementedISR,       // vector 11   - TPM2 overflow
        UnimplementedISR,       // vector 10   - TPM2 channel 2
        UnimplementedISR,       // vector 09   - TPM2 channel 1
        UnimplementedISR,       // vector 08   - TPM2 channel 0        
        IRQTimer1,              // vector 07   - TPM1 overflow
        UnimplementedISR,       // vector 06   - TPM1 channel 2
        UnimplementedISR,       // vector 05   - TPM1 channel 1
        UnimplementedISR,       // vector 04   - TPM1 channel 0
        UnimplementedISR,       // vector 03   - Low voltage detect, Low voltage warning
        IRQIsr,                 // vector 02   - External IRQ (MC1319x interrupt)
        UnimplementedISR,       // vector 01   - Software interrupt (SWI)
                                // vector 00   - Reset (Watchdog timer, Low voltage detect, external pin, illegal opcode)
};


 
#else
  #if defined (HCS08G)

  // Added redirected ISR vectors when BootLoader is enabled.
  // The application cannot have a reset vector (resides in BootLoader).
  #if (EMBEDDED_BOOTLOADER == TRUE) 
      // Redirected ISR vectors
      const tIsrFunc _vect[] @0xEFCC = {  /* Interrupt table */
  #else
      const tIsrFunc _vect[] @0xFFCC = {  /* Interrupt table */
  #endif 
          UnimplementedISR,       /* vector 25: RT */
          UnimplementedISR,       /* vector 24: IIC */
          UnimplementedISR,       /* vector 23: ATD */
          UnimplementedISR,       /* vector 22: KBI */
          UnimplementedISR,       /* vector 21: SCI2TX */
          UnimplementedISR,       /* vector 20: SCI2RX */
          UnimplementedISR,       /* vector 19: SCI2ER */
          UnimplementedISR,       /* vector 18: SCI1TX */
          isrSCI          ,       /* vector 17: SCI1RX */
          UnimplementedISR,       /* vector 16: SCI1ER */
          UnimplementedISR,       /* vector 15: SPI */
          UnimplementedISR,       /* vector 14: TPM2OF */
          UnimplementedISR,       /* vector 13: TPM2C4 */
          UnimplementedISR,       /* vector 12: TPM2C3 */
          UnimplementedISR,       /* vector 11: TPM2C2 */
          UnimplementedISR,       /* vector 10: TPM2C1 */
          UnimplementedISR,       /* vector 09: TPM2C0 */
          UnimplementedISR,       /* vector 08: TPM1OF */
          UnimplementedISR,       /* vector 07: TPM1C2 */
          UnimplementedISR,       /* vector 06: TPM1C1 */
          UnimplementedISR,       /* vector 05: TPM1C0 */
          UnimplementedISR,       /* vector 04: ICG */
          UnimplementedISR,       /* vector 03: Low Voltage Detect */
          IRQIsr,                 /* vector 02: IRQ pin */
          UnimplementedISR        /* vector 01: SWI */
          /*_Startup, by default in library*/ /* Reset vector */
      };
  #endif
#endif


